home *** CD-ROM | disk | FTP | other *** search
/ Executor 2.0 / executorv2.0.iso / mac / demoware / Asymptote 1.1 Demo / Scripts / Demos / 4) HST Stars / Demo4 next >
Encoding:
Text File  |  1994-11-01  |  1.5 KB  |  66 lines  |  [TEXT/DWat]

  1. % Asymptote Demo #5
  2.  
  3. % This script shows how to read data 
  4. % from rows of a data file and plot 
  5. % a histogram.
  6.  
  7. datafile HST STARS
  8. fontname Times
  9. pensize .5
  10.  
  11. % Choose which columns to read
  12. datacolumns 4 20
  13. % Then read them into x and y from rows 1 and 2
  14. readrow x 1
  15. readrow y 2
  16.  
  17. % Close the datafile, we're done with it
  18. close \f
  19.  
  20. graphlimits                                            % Find the graph limits
  21. graphlimits xright xleft ybottom ytop        % Then plot x backwards
  22. graphunits in
  23. graphframe 2 7 2 5
  24. fullscreen yes
  25.  
  26. % Choose the fill pattern to fill under the histogram
  27. fillpat gray
  28. plothistogram 0.0                    % Use 0.0 to for the baseline
  29.  
  30. % Specify our own tick mark spacing in units we like
  31. graphticks .5 1 2e5 1e6
  32. ticksize 9                            % Use 9 point ticks
  33.  
  34. % Make the pen bigger and draw just the frame with no ticks or labels
  35. % This puts a thick border around the graph
  36. pensize 2
  37. drawframe inside inside noticks nolabels nolabels nolabels nolabels
  38.  
  39. % Now draw the thin tick marks and tick mark labels
  40. pensize 0.25  % hairline
  41. % Specify a notation
  42. notation general
  43. % Now draw the frame
  44. drawframe
  45.  
  46. % Set the scale factor to draw the title a bit bigger
  47. scale 1.5
  48. drawtitle  HST Guide Star Catalog
  49.  
  50. % Use a macro 'TL' (defined in the macros file) to move to the top right
  51. TR
  52. rpn <y sum >y
  53. digits 1
  54. drawlabel belowleft \y(1) Stars
  55.  
  56. % Make the x and y labels a little smaller than the title
  57. scale 1
  58. drawxlabel Visual Magnitude
  59. drawylabel Number of Stars
  60.  
  61. % Add a subtitle to the x axis by moving the frame down 0.25 inches
  62. graphframe gleft gright gbottom 0.25 - gtop
  63. scale 0.8
  64. drawxlabel Data read from rows of a file
  65.  
  66.